package com.hnevc.nbastar;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.bumptech.glide.Glide;

public class NBAStarDetailActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_nba_star_detail);

        // 获取跳转对象
        Intent intent = getIntent();
        NBAStarItem item = (NBAStarItem) intent.getSerializableExtra("item");

        // 初始化UI
        ImageView avatar = findViewById(R.id.iv_detail_avatar);
        TextView tvPosition = findViewById(R.id.tv_position);
        TextView tvMvpTimes = findViewById(R.id.tv_mvp_times);
        TextView tvFmvpTimes = findViewById(R.id.tv_fmvp_times);
        TextView tvChampianTimes = findViewById(R.id.tv_champian_times);


        // 填充头像
        Glide.with(this)
                .load(item.getAvatar())
                .into(avatar);
        // 球队位置
        String positionStr = "";
        switch (item.getPosition()){
            case 1:
                positionStr = "得分后卫";
                break;
            case 2:
                positionStr = "中锋";
                break;
            case 3:
                positionStr = "小前锋";
                break;
            case 4:
                positionStr = "控球后卫";
                break;
            case 5:
                positionStr = "大前锋/中锋";
                break;
            case 6:
                positionStr = "组织前锋";
                break;
            case 7:
                positionStr = "中锋";
                break;
            case 8:
                positionStr = "小前锋";
                break;
            case 9:
                positionStr = "后卫";
                break;
            default:

                break;
        }
        tvPosition.setText(positionStr);
        // MVP 次数
        tvMvpTimes.setText(String.valueOf(item.getMvpTimes()));
        // FMVP 次数
        tvFmvpTimes.setText(String.valueOf(item.getFmvpTimes()));
        // 总冠军次数
        tvChampianTimes.setText(String.valueOf(item.getChampionTimes()));
    }
}
